package com.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class Config implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry){
        //addInterceptor 添加拦截器
        //addPathPatterns 添加拦截的路径
        //excludePathPatterns 添加拦截路径中 特殊放行的路径
        registry.addInterceptor(new UserInfoInterceptor())
                .addPathPatterns("/**");
    }
}
